<template>
<view>

  <view>欢迎您登录心之约商城</view>
  <view style="margin-top: 20rpx;margin-bottom: 20rpx">

    <button class="ss-reset-button buy-btn ui-Success-Main" open-type="getPhoneNumber"
            @getphonenumber="wechatLogin">
      <view class="ss-flex">
<!--        <image class="auto-login-img" :src="sheep.$url.static('/image/weixin.svg')"/>-->
        <view>手机号快捷登录</view>
      </view>
    </button>

    <view style="height: 10rpx"></view>
    <!-- 分割线 -->

    <view class="divider">
      <text>或</text>
    </view>

<!--    <view>-->
<!--      <uni-forms ref="form" :modelValue="formData" :rules="rules">-->
<!--        <uni-forms-item label="姓名" name="name">-->
<!--          <uni-easyinput  prefixIcon="user" type="text" v-model="formData.name" placeholder="请输入手機號" />-->
<!--        </uni-forms-item>-->
<!--        <uni-forms-item label="邮箱" name="email">-->
<!--          <uni-easyinput  prefixIcon="password"  type="password" v-model="formData.email"  placeholder="請輸入密碼" />-->
<!--        </uni-forms-item>-->
<!--      </uni-forms>-->
<!--      <button @click="submit">Submit</button>-->
<!--    </view>-->

<!--    <view class="other-options">-->
<!--      <text @click="toForgetPassword">忘记密码</text>-->
<!--      <text @click="toRegister">注册账号</text>-->
<!--    </view>-->

    </view>
  </view>
</template>

<script setup>
import sheep from '@/sheep'
import {computed,reactive} from "vue";
import { closeAuthModal } from '@/sheep/hooks/useModal';

const appInfo = computed(() => sheep.$store('app').info);

const state = reactive({
  protocol: false,
});
const formData=reactive({
  name: '',
  age: '',
})
const rules={
  name: {
    rules: [{
      required: true,
      errorMessage: '请输入姓名',
    }]
  },
  email: {
    rules: [{
      required: true,
      errorMessage: '请输入邮箱',
    }]
  }
}
//勾选协议
function onChange() {
  state.protocol = !state.protocol;
}

async function wechatLogin(e) {
  const loginRes = await sheep.$platform.useProvider("wechat").login(e.detail);
  if (loginRes) {
    sheep.$helper.toast('登录成功')
    closeAuthModal();
  }
}

async function userLoginByInput() {
      console.log(formData)
  if( formData.name.trim() !=='' && formData.email.trim()!==''){
      console.log('登录成功')
  }else{
    sheep.$helper.toast('请输入账号和密码')
  }

}


// 查看协议
function onProtocol(id, title) {
  closeAuthModal();
  sheep.$router.go('/pages/public/richtext', {
    id,
    title,
  });
}

// 请先登录提示
function handleTip(){
  uni.showToast({
    title: "请勾选我已阅读并同意《用户协议》与《隐私政策》！",
    icon: "none",
    mask: true
  });
}

</script>


<style lang="scss" scoped>
.cancel-btn {
  width: 100%;
  height: 72rpx;
  font-weight: 500;
  font-size: 28rpx;

  border-radius: 40rpx;
  background: red;
  color: $white;
}
.btnStyle{
  border: none;
  font-size: 15px;
  padding: 0 !important;
  color: #82ABCC;
  margin: 0;
  background-color: transparent;
  &::after{
    border:none;
  }
}
.agreement-text{
  justify-content: center;
  position: absolute;
  bottom: 0;
  width: calc(100% - 68rpx);
}
.buy-btn {
  width: 100%;
  height: 72rpx;
  font-weight: 500;
  font-size: 28rpx;

  border-radius: 40rpx;
  background: #0DD116;
  color: $white;
}
.auto-login-img {
  width: 48rpx;
  height: 48rpx;
  border-radius: 50%;
}
</style>
